package com.example.utils;


import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * The type Result utils.
 */
public class ResultUtils {
    /**
     * 结果返回
     *
     * @param msg    the msg
     * @param object the object
     * @return result data
     */
//执行失败
    public static ResultData error(String msg, Object object) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = formatter.format(new Date());
        return new ResultData(false, 500, msg, time, object);
    }

    /**
     * Sucuss result data.
     *
     * @param msg    the msg
     * @param object the object
     * @return the result data
     */
//执行成功
    public static ResultData sucuss(String msg, Object object) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = formatter.format(new Date());
        return new ResultData(true, 200, msg, time, object);
    }

}